package com.example.mall.controller;



import com.example.mall.pojo.Rbody;
import com.example.mall.utils.JwtUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class TokenController {

    @GetMapping("/token")
    public Rbody testToken() {
        Rbody rbody = new Rbody();
        // 创建token， 返回给 用户
        String token = JwtUtils.createToken("500", "admin");
        rbody.setData(token);

        rbody.getMeta().setMsg("令牌获取成功 ！");
        return rbody;
    }
}

